package com.fjp.heartguard.viewmodel

import androidx.databinding.ObservableField
import androidx.lifecycle.MutableLiveData
import com.fjp.heartguard.app.base.HTBaseViewModel
import com.fjp.heartguard.app.data.bean.AccountState
import com.fjp.heartguard.app.data.bean.AppVersion
import com.fjp.heartguard.app.network.HttpRequestCoroutine
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

class HomeViewModel : HTBaseViewModel() {
    val hasMoreAction = ObservableField<Boolean>(false)
    var accountState = MutableLiveData<ResultState<AccountState>>()
    var appVersion = MutableLiveData<ResultState<AppVersion>>()

    fun getState(version: String) {
        request({
            HttpRequestCoroutine.getState(version)
        }, accountState, false)

    }

    fun checkVersion() {
        request({
            HttpRequestCoroutine.checkVersion()
        }, appVersion, false)

    }
}